local hx__daoshu = fk.CreateSkill {
  name = "hx__daoshu",
}

hx__daoshu:addEffect("active", {
  anim_type = "offensive",
  prompt = "#hx__daoshu",
  card_num = 0,
  target_num = 1,
  can_use = function(self, player)
    return true
  end,
  card_filter = Util.FalseFunc,
  target_filter = Util.TrueFunc,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    local x = player:getMark("@hx__qinggang")
    local choices = {}
    for i = 1, x do
      table.insert(choices, tostring(i))
    end
    if x == 0 then
      room:damage({
        from = player,
        to = target,
        damage = 1,
        skillName = hx__daoshu.name,
      })
      room:invalidateSkill(player, hx__daoshu.name, "-turn")
    else
      local choice = room:askToChoice(player, {
        choices = choices,
        skill_name = hx__daoshu.name,
        prompt = "请选择对其造成的伤害值",
      })
      local num = tonumber(choice)
      room:damage({
        from = player,
        to = target,
        damage = num,
        skillName = hx__daoshu.name,
      })
      room:removePlayerMark(player, "@hx__qinggang", num)
      if player:getMark("@hx__qinggang") == 0 then
        room:invalidateSkill(player, hx__daoshu.name, "-turn")
      end
    end
  end,
})


return hx__daoshu